package com.sjqg.dao;
import java.sql.SQLException;
import java.util.List;

import org.apache.commons.dbutils.handlers.BeanHandler;
import org.apache.commons.dbutils.handlers.BeanListHandler;
import com.sjqg.model.Technicain;



public class TechnicainDao extends BaseDao {
	public List<Technicain> getAll(){
		try {
			String sql="select id, company, logo, avatar, nickname"
					+ " , price, message, detail, lat, lon from technicain"
					+ " order by id";
			return queryRunner.query(sql, new BeanListHandler<>(Technicain.class));
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return null;
	}

	public Technicain getAll(int id) {
		try {
			String sql="select id, company, logo, avatar, nickname"
					+ " , price, message, detail, lat, lon from technicain"
					+ " where id = ? order by id";
			return queryRunner.query(sql, new BeanHandler<Technicain>(Technicain.class), id);
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return null;
	}
}